package cn.com.dashihui.api.ITask;

import com.jfinal.aop.Duang;

import cn.com.dashihui.api.service.GroupbuyingService;
import cn.com.dashihui.api.service.OrderService;
import cn.com.dashihui.kit.ThreadPoolKit;

public class SpikeOrder  implements Runnable{
	//使用Duang.duang进行封装，使普通类具有事务的功能
	private OrderService service = Duang.duang(OrderService.class);
	private GroupbuyingService groupService = Duang.duang(GroupbuyingService.class);
	public void run() {
		
		ThreadPoolKit.expireOrderThreadPool.execute(new Runnable(){

			@Override
			public void run() {
				try {
					//每分钟轮询秒杀未付款非人为取消订单失效 
					service.changeSpike();
				} catch (Exception e) {
					e.printStackTrace();
					
				}
			}
			
		});
		ThreadPoolKit.expireOrderThreadPool.execute(new Runnable(){

			@Override
			public void run() {
				try {
					//每分钟轮询团购未付款非人为取消订单失效 
					groupService.changeGroup();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			
		});
		
	
//		try {
//			//轮询待评价自动好评
//			service.changeSpike();
//	    } catch (Exception e) {
//	    	  System.out.println("---------------------"+e);
//	    }

	}

}
